<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <input type="file" name="" id="" class="inp">
    <script>
        var inp = document.querySelector('.inp');
        var imgSrc = '';
        console.log(inp);
        inp.onchange = function(){
            console.dir(this);
            console.log(this.files[0]);
            var f = this.files[0];
            var fr = new FileReader();
            fr.readAsDataURL(f);
            fr.onload = function(){
                console.log(fr);
                console.log(fr.result);
                imgSrc = fr.result;
                console.log(imgSrc);

            }
        }
    </script>
</body>
</html>